/*
 * Copyright 2005-2007 Pulse Technologies. Tutti i diritti riservati.
 */

package org.obsidianrad.server.services.obj2db.hessian;

import org.obsidianrad.server.services.ObsModel;
import org.obsidianrad.server.services.obj2db.Obj2DbProxy;
import org.obsidianrad.server.services.obj2db.commodities.Filterer;
import org.obsidianrad.server.services.obj2db.commodities.PagingLoadConfig;
import org.obsidianrad.server.services.obj2db.commodities.PagingLoadResult;
import org.obsidianrad.utils.ObjProxyException;
import org.obsidianrad.utils.Token;


/**
 * 
 * @author eliosh
 * @version $Rev: 4 $
 * @lastautorcommit $Author: eliosh $
 * @lastdatecommit $Date: 2009-10-31 12:37:28 +0100(sab, 31 ott 2009) $
 */
public class Obj2DbHessianProxyImpl implements Obj2DbHessianProxy{
	private Obj2DbProxy proxy;

	public Obj2DbProxy getProxy() {
		return proxy;
	}

	public void setProxy(Obj2DbProxy proxy) {
		this.proxy = proxy;
	}

	@Override
	public <T extends ObsModel> Integer deleteMany(FiltererHessian reference) throws ObjProxyException {
		Filterer convertFromHessian = new Filterer(reference.getTypeObject());
		convertFromHessian.convertFromHessian(reference);
		return proxy.deleteMany(convertFromHessian);
	}

	@Override
	public <T extends ObsModel> void deleteOne(T reference, Token<T> token) throws ObjProxyException {
		proxy.deleteOne(reference, token);
	}

	@Override
	public <T extends ObsModel> void discardToken(Token<T> token) {
		proxy.discardToken(token);
	}

	@Override
	public <T extends ObsModel> PagingLoadResult<T> getList(FiltererHessian reference, PagingLoadConfig config) throws ObjProxyException {
		Filterer convertFromHessian = new Filterer(reference.getTypeObject());
		convertFromHessian.convertFromHessian(reference);
		return proxy.getList(convertFromHessian, config);
	}

	@Override
	public <T extends ObsModel> PagingLoadResult<T> getListByExample(T reference, PagingLoadConfig config) throws ObjProxyException {
		return proxy.getListByExample(reference, config);
	}

	@Override
	public <T extends ObsModel> T getSingle(T reference) throws ObjProxyException {
		return proxy.getSingle(reference);
	}

	@Override
	public <T extends ObsModel> Token<T> getToken(T reference) {
		return proxy.getToken(reference);
	}

	@Override
	public <T extends ObsModel> Token<T> refreshToken(Token<T> token) {
		return proxy.refreshToken(token);
	}

	@Override
	public <T extends ObsModel> String save(T reference) throws ObjProxyException {
		return proxy.save(reference);
	}

	@Override
	public <T extends ObsModel> int updateMany(FiltererHessian reference) throws ObjProxyException {
		Filterer convertFromHessian = new Filterer(reference.getTypeObject());
		convertFromHessian.convertFromHessian(reference);
		return proxy.updateMany(convertFromHessian);
	}

	@Override
	public <T extends ObsModel> T updateOne(T reference, Token<T> token) throws ObjProxyException {
		return proxy.updateOne(reference, token);
	}
	
	
	
}
